CC      = arm-linux-gcc
LD      = arm-linux-ld
AR      = arm-linux-ar
OBJCOPY = arm-linux-objcopy
OBJDUMP = arm-linux-objdump

INCLUDEDIR 	:= $(shell pwd)/include
CFLAGS 		:= -Wall -O2 -fno-builtin
CPPFLAGS   	:= -nostdinc -I$(INCLUDEDIR)


CFLAGS 		:= -Wall -O2 -fno-builtin -ffreestanding -nostdlib
led_wtd.bin: init.o main.o uart.o lib/libc.a
	arm-linux-ld -Ttext 0x0 -o led.elf $^
	arm-linux-objcopy -O binary led.elf led.bin
	arm-linux-objdump -D led.elf > led_elf.dis


%.o : %.S
	arm-linux-gcc $(CFLAGS) -o $@ $< -c

%.o : %.c
	arm-linux-gcc $(CFLAGS) -o $@ $< -c 

.PHONY : lig/libc.a
lib/libc.a:
	cd lib; make; cd ..
clean:
	rm *.o *.elf *.bin *.dis forlinx -f
